import 'package:liuxlcommon/lget/lget.dart';
import 'package:ladder_cash/app/com/view/base_column.dart';
import 'package:ladder_cash/app/com/view/common_view.dart';
import 'package:ladder_cash/app/com/view/my_app_bar.dart';
import 'package:ladder_cash/app/com/view/my_app_bar2.dart';
import 'package:ladder_cash/app/comm_key_def.dart';
import 'package:ladder_cash/app/page/component/decoration_bg.dart';
import 'package:ladder_cash/app/page/product_detail/questionnaire_survey_page.dart';
import 'package:ladder_cash/generated/assets.dart' as myAssets;
import 'package:ladder_cash/value/app_colors.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:liuxlcommon/view/extension_widget.dart';
import 'package:liuxlcommon/view/loading_view.dart';
import 'package:liuxlcommon/view/lxl_widget.dart';
import 'package:liuxlcommon/view/my_box.dart';
import 'package:liuxlcommon/view/my_style.dart';

import '../../../Global.dart';
import '../../../gen/assets.gen.dart';
import '../component/base_page_bg.dart';
import '../component/common.dart';
import 'authentication_logic.dart';
import 'bank_information_page.dart';
import 'emergency_contact_page.dart';
import 'id_auth/id_information_page.dart';
import 'job_information_page.dart';
import 'persona_information_page.dart';
class AuthenticationPage extends StatefulWidget {
   AuthenticationPage({super.key});

  @override
  _AuthenticationPageState createState() => _AuthenticationPageState();
}

class _AuthenticationPageState extends State<AuthenticationPage> {
  final logic = Get.put(AuthenticationLogic());

  @override
  Widget build(BuildContext context) {
    logic.context = context;
    return GestureDetector(
      onTap: () {
        // FocusScope.of(context).requestFocus(FocusNode());
        OldLInput.unfocus();
      },
      child: GetBuilder<AuthenticationLogic>(
          builder: (l) => pageDetail()),
    );
  }
  Widget pageDetail() {
    return getBasePageBg(
        child: LColumn.eazy([
          getTabBar(title: logic.title,callback: (){
            Get.back();
          },isShowRight: true),
          Expanded(child: body)
        ]));
  }

  get stSty => LStyle(width: 321.w, height: 37.w);

  get body => LoadingView(
        isPullDown: true,
        future: () => logic.getProductData(),
        datas: logic.productData,
        onSuccess: () {
          if (logic.productData != null) {
            setState(() {});
          }
        },

        ///不能加const 不然不会更新
        body: () => <String, Widget>{
          CommKeyDef.credit: QuestionnaireSurveyPage(),
          CommKeyDef.public: IdInformationPage(),
          CommKeyDef.personal: PersonaInformationPage(),
          CommKeyDef.job: JobInformationPage(),
          CommKeyDef.ext: EmergencyContactPage(),
          CommKeyDef.bank: BankInformationPage()
        }[logic.steepKey]!,
      );

  @override
  void dispose() {
    Get.delete<AuthenticationLogic>();
    super.dispose();
  }
}
